﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SCFHS.Code;
using SCFHS.Data;
using System.Web.Security;
using System.Configuration;
namespace SCFHS.Views
{
    public class SysBase : System.Web.UI.Page
    {
        public Controller controller = new Controller();
        public SCFHS.Data.Order order = new Data.Order();

        public User user
        {
            get
            {
                if (!User.Identity.IsAuthenticated)
                {
                    FormsAuthentication.RedirectToLoginPage();
                    return null;
                }
                return User as SCFHS.Data.User;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!User.Identity.IsAuthenticated)
            {
                FormsAuthentication.RedirectToLoginPage();
                return;
            }

        }

        public static string parseOrderStateAr(string orderStateCode)
        {
            try
            {
                return ConfigurationManager.AppSettings[orderStateCode].ToString();
            }
            catch (Exception)
            {
                return "";
            }
        }
    }
}